<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			window.onload = function()
			{
				let month = document.querySelector('#month');
				let btn = document.querySelector('button');
				
				btn.onclick = function()
				{
					if((month.value > 1 || month.value == 1) && (month.value < 12 || month.value == 12))
					{
						alert('合法');
					}
					else
					{
						alert('非法');
					}
				}
			}
		</script>
	</head>
	<body>
		<input type="text" id="month" placeholder="请输入月份">
		<button>判断</button>
	</body>
</html>